<!DOCTYPE HTML>
<html>
<head>
    <title>枣阳市第二人民医院信息管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="assets/css/dpl-min.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/bui-min.css" rel="stylesheet" type="text/css"/>
    <link href="assets/css/main-min.css" rel="stylesheet" type="text/css"/>
</head>
<body>


<!--<div class="header">

    <div class="dl-title">
        <img src="/chinapost/Public/assets/img/top.png">
    </div>

    <div class="dl-log">欢迎您，<span class="dl-log-user">张三</span><a href="/chinapost/index.php?m=Public&a=logout" title="退出系统" class="dl-log-quit">[退出]</a>
    </div>
</div>-->
<div class="content">
    <div class="dl-main-nav">
        <div class="dl-inform">
            <div class="dl-inform-title"><s class="dl-inform-icon dl-up"></s></div>
        </div>
        <ul id="J_Nav" class="nav-list ks-clear" style="float:left">
            <!--<li class="nav-item dl-selected"><div class="nav-item-inner nav-home">信息采编系统</div></li>-->
            <li style=" color:#fff; font-size:20px; margin-top:10px; margin-left:20px;">山东省第二人民医院管理平台</li>
        </ul>
        <span id="uid" style="visibility: hidden"></span>
        <div style="float:right; color:#fff;">欢迎您，<span id="userInfo" class="dl-log-user">张三</span><a
                style="cursor: pointer" id="logout" title="退出系统" class="dl-log-quit">[退出]</a></div>
    </div>

    <ul id="J_NavContent" class="dl-tab-conten">
    </ul>
</div>
<script type="text/javascript" src="assets/js/jquery-1.6.js"></script>
<script type="text/javascript" src="assets/js/bui.js"></script>
<script type="text/javascript" src="assets/js/common/main-min.js"></script>
<script type="text/javascript" src="assets/js/config-min.js"></script>


<script>


    function loadUserInfo() {
        $.ajax(
            {
                type: "GET",
                url: "/admin/userInfo",
                async:false,
                data: "",
                success: function (vo) {
                    let userInfo = $("#userInfo");
                    let uid = $("#uid");
                    if (vo.code == 200) {
                        userInfo.html(vo.list[0]);
                        uid.html(vo.list[1]);
                    } else {
                        userInfo.html(vo.msg);
                    }
                }
            }
        )
    }

    $(function () {
        loadUserInfo();
        $("#logout").click(function () {
            $.ajax({
                type: "GET",
                url: "/admin/logout",
                data: "",
                success: function (vo) {
                    if (vo.code == 200) {
                        alert(vo.obj);
                        window.location.href = "login.html";
                    } else {
                        alert(vo.msg);
                    }
                }
            })
        })
        BUI.use('common/main', function () {
            let items=[];
            $.ajax({
                type: "GET",
                url: "/user/"+$("#uid").html(),
                success: function (vo) {
                    if (vo.code == 200) {
                        let obj=vo.obj;
                        let roleId=obj.role.roleId;
                        $.ajax({
                            type: "GET",
                            url: "role_resource/role/"+roleId,
                            success:function (vo){
                                if (vo.code == 200) {
                                    let list=vo.list;
                                    for(let i=0;i<list.length;i++) {
                                        items.push({id: list[i].resource.resourceId, text: list[i].resource.resourceName, href: list[i].resource.url});
                                    }
                                    let config = [
                                        {
                                            id: '1', menu: [

                                                {
                                                    text: '快速通道', items: items
                                                }

                                            ]
                                        }

                                    ];
                                    console.log(config);
                                    new PageUtil.MainPage({
                                        modulesConfig: config
                                    });
                                }else {
                                    alert(vo.msg);
                                }
                            }
                        })
                    } else {
                        alert(vo.msg);
                    }
                }
            })

        });
    })

</script>
</body>
</html>